<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<%@ page import="com.gph.saviorframework.common.model.User" %>
<%@ page import="org.apache.shiro.SecurityUtils" %>
<%
  User user = (User) SecurityUtils.getSubject().getPrincipal();
%>
<%@ include file="/include/taglibs.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false" %>
<html>
<head>
  <%@ include file="/include/min_base.jsp" %>
  <link rel="stylesheet" href="${ctx}/css/base.css"/>
  <link rel="stylesheet" href="${ctx}/assets/admin/LingUI/css/bootstrap-select.css" />
  <script src="${ctx}/assets/admin/LingUI/js/bootstrap-select.js" type="text/javascript"></script>
  <title>编辑Token管理信息</title>
  <style>
    .w_auto {
      width: 30%;
      float: left;
      padding: 2px 5px;
    }
    .bootstrap-select.form-control:not([class*="col-"]){
      width:70%;
    }
  </style>
</head>
<body>
<div class="row" style="margin:0px;padding:0px;">
  <div class="col-md-12">
    <h3 class="pub_title"><span>客户端管理信息</span></h3>

    <form id="ayy" method="post" class="form-horizontal">
      <div class="form-group">
        <label for="clientSecret" class="col-sm-3 control-label" style="font-weight: 500">编号：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="clientSecret" name="clientSecret"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="name" class="col-sm-3 control-label" style="font-weight: 500">客户端名称：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="name" name="name"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="clientUri" class="col-sm-3 control-label" style="font-weight: 500">clientUri：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="clientUri" name="clientUri"
                 required="true" style="width: 70%;;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="iconUri" class="col-sm-3 control-label" style="font-weight: 500">iconUri：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="iconUri" name="iconUri"
                 required="true" style="width: 70%;;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="resourceIds" class="col-sm-3 control-label" style="font-weight: 500">resourceIds：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="resourceIds" name="resourceIds"
                 required="true" style="width: 70%;;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="first-disabled2" class="col-sm-3 control-label" style="font-weight: 500">范围：</label>

        <div class="col-sm-9">
          <select class="form-control selectpicker"   id="first-disabled2" class="selectpicker" multiple data-hide-disabled="true" data-size="100"
                  name="scope" data-placeholder="请选择范围..."  style="width: 70%;;float: left;">
            <option value="">&nbsp;</option>
            <option value="AL">Alabama</option>
            <option value="AK">Alaska</option>
            <option value="AZ">Arizona</option>
            <option value="AR">Arkansas</option>
            <option value="CA">California</option>
          </select>
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="grantTypes" class="col-sm-3 control-label" style="font-weight: 500">许可方式：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="grantTypes" name="grantTypes"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="redirectUri" class="col-sm-3 control-label" style="font-weight: 500">许可方式：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="redirectUri" name="redirectUri"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="roles" class="col-sm-3 control-label" style="font-weight: 500">规则：</label>

        <div class="col-sm-9">
          <select class="form-control selectpicker"   id="roles" class="selectpicker" multiple data-hide-disabled="true" data-size="100"
                  name="roles" data-placeholder="请选择范围..."  style="width: 70%;float: left;">
            <option value="">&nbsp;</option>
            <option value="AL">Alabama</option>
            <option value="AK">Alaska</option>
            <option value="AZ">Arizona</option>
            <option value="AR">Arkansas</option>
            <option value="CA">California</option>
          </select>
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="accessTokenValidity" class="col-sm-3 control-label" style="font-weight: 500">accessTokenValidity：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="accessTokenValidity" name="accessTokenValidity"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="refreshTokenValidity" class="col-sm-3 control-label" style="font-weight: 500">refreshTokenValidity：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="refreshTokenValidity" name="refreshTokenValidity"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="description" class="col-sm-3 control-label" style="font-weight: 500">描述：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="description" name="description"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="archived" class="col-sm-3 control-label" style="font-weight: 500">archived：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="archived" name="archived"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>
      <div class="form-group">
        <label for="trusted" class="col-sm-3 control-label" style="font-weight: 500">trusted：</label>

        <div class="col-sm-9">
          <input type="text" class="form-control" id="trusted" name="trusted"
                 required="true" style="width: 70%;float: left;" />
          <span class="tips">*</span>
        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-5 control-label">&nbsp;</label>

        <div class="col-sm-7">
          <button type="submit" class="btn btn-primary" id="J_submit">保存</button>
        </div>
      </div>
    </form>
  </div>
</div>

<script type="text/javascript">
  $(function () {
  });
  /**
   * 提交数据
   */
  $('#J_submit').on('click',function(){
    submitData();
  });

  function submitData() {
    if (true) {
      $.ajax({
        type:'POST',
        url:'${ctx}/${appPath}/achievement/evaluate/edit',
        async:false,
        dataType:'json',
        traditional:true,
        data:data1,
        beforeSend: function (XMLHttpRequest) {
          //发送前显示遮罩层，无法再次点击，只能等请求结束后才能进行页面操作
          $('#J_submit').hide();
        },
        success:function(data){
          if (data.success) {
            parent.lui.success('保存成功');
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
          } else {
            parent.lui.fail("保存失败:" + data.message);
          }
        },
        error: function(XmlHttpRequest, textStatus, errorThrown){
          $('#J_submit').show();
          parent.lui.fail('添加数据失败！');
        },
        complete: function (jsondata, stat) {
          $('#J_submit').show();
        }
      });
    } else {
      return;
    }
  };
</script>
</body>
</html>
